<?
require("config.php");

$show_backnav = "product_menu";
$location_status .= "| Edit";

$menuname = array(
	"Info",
	"Pictures",
	"Color",
	"Size",
	"Specification",
	"Features",
	"Accessories",
	"Packaging",
);

$menutarget = array(
	"edit",
	"edit_pictures",
	"edit_color",
	"edit_size",
	"edit_specification",
	"edit_features",
	"edit_accessories",
	"edit_packaging",
);

$menutype = 2;

if (NULL!=$action){

for ($i=0;$i<count($Sizes);$i++) {

	$Size .= "," . $Sizes[$i];
}

	$Size = substr($Size,1);

   $field = array(
	"size",
	);


   $content = array(
	$Size
	);

   $expression = "id=$id";

   myUpdate($table,$field,$content,$expression);


   header("location:edit_info.php?id=$id&target=edit_specification&a=3");
   exit();

}


if (!checkRecord($table,$id)){

	header("location:" . $rela_path . "share/msg.php?v=9002");
  
}

$Query = "select size from pro_basic where id=$id Limit 1";
$r = myQuery($Query);

$itemsizes=$r[0][0];

$Query = "select name from pro_size";
$sizes = myQuery($Query);

require($rela_path . "inc/header.php");

?>

<!--Content Start-->
<!--Content Start-->
<form name="form1" method="post" action="">

<!--hidden filed-->
<input name="action" type="hidden" value="edit">
<input name="id" type="hidden" value="<?print($id)?>">


                    <table width="95%" border="0" align="center">
                      <tr> 
                        
      <td align="right">
	  
	  <input type="image" src="../../images/bt_cancel.gif" width="78" height="23" onclick="Redirect('product_menu.php',1);return false;"> 
        <input type="image" src="../../images/bt_save.gif" width="76" height="22"> 



      </td>
                      </tr>
                    </table>
                    <table width="95%" border="0" align="center">
                      <tr> 
                        <td align="right">&nbsp; </td>
                      </tr>
                      <tr> 
                        
      <td class="tdheader"><br>
        Choose the size:<br> <br>      
		<table width="100%" border="0" cellspacing="1" cellpadding="0" class="tb">


<?
$itemsize = split(",",$itemsizes);

for ($i=0;$i<count($sizes);$i=$i+1){
                    	
	if ($i%2==0) print ("<tr class=tbcontent1>");

	$active = NULL;
	if (in_array($sizes[$i][0], $itemsize)) $active = "CHECKED";
                    	
?>
                    
	<td width="50%"> 
	<input type="checkbox" name="Sizes[]" value="<?print($sizes[$i][0])?>" <?print($active)?>>
	<?print($sizes[$i][0])?>
	</td>


<?

if ($i%2==1) {

	print ("</tr>");

}else if ($i==count($sizes)-1) {

	print ("<td>&nbsp;</td></tr>");

}
                      
}
?>

        </table>
        <br></td>
                      </tr>
                    </table>
                    <table width="95%" border="0" align="center">
                      <tr> 
                        
      <td align="right">
	  
	  <input type="image" src="../../images/bt_cancel.gif" width="78" height="23" onclick="Redirect('product_menu.php',1);return false;"> 
        <input type="image" src="../../images/bt_save.gif" width="76" height="22"> 



      </td>
                      </tr>
                    </table>
                  
  <p>&nbsp;</p>
  <p>&nbsp;</p>
  <p>&nbsp;</p>
</form>
            <!--Content End-->
            <?
require($rela_path . "inc/footer.php");
?>
        